<template>
	<view class="bg-white flex flex-direction" style="height: 100vh; width: 100vw;">
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">
				<text style="font-size: 32rpx;">获得的点赞</text>
			</block>
		</cu-custom>
		<scroll-view class="flex flex-direction flex-sub bg-white" scroll-y="true" style="width: 100%;">
			<view v-for="(likedItem, index) in likedList" :key="index" class="flex flex-direction justify-between solid-bottom" style="padding: 24rpx 32rpx;">
				<view class="flex flex-direction justify-between align-center" @click="goToContentDetail(likedItem.contentId, likedItem.columnType)">
					<image :src="likedItem.cover" mode="aspectFit" style="height: 280rpx;width: 250rpx;"></image>
					<text style="font-size: 32rpx; color: #333333; font-weight: bold;">{{likedItem.title}}</text>
				</view>
				<view class="flex justify-between align-center margin-top-sm">
					<view class="flex align-center" @click="goToProfile(likedItem.userId)">
						<view class="cu-avatar round" style="height: 96rpx; width: 96rpx;" :style="{'background-image':'url('+(likedItem.avatar)+')'}"></view>
						<text style="font-weight: bold;margin-left: 14rpx;">{{likedItem.username}}</text>
					</view>
					<text style="font-size: 32rpx; color: #333333;">给你点了个赞👍！</text>
				</view>
			</view>
			<view v-if="!likedList || likedList.length<1" class="flex justify-center" style="margin-top: 40rpx; font-size: 40rpx;">
				还没有获赞呢
			</view>
		</scroll-view>
	</view>
	
</template>

<script>
	import loadMore from '../../components/mine/loadMore.vue';
	import followCell from '../../components/mine/followCell.vue';
	export default {
		components: {
			loadMore,
			followCell
		},
		data() {
			return {
				//请求参数
				userId: this.$store.getters.userid,
				likedList: [],
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar,
				bgColor: '',
			}
		},
		computed: {
			style() {
				var StatusBar= this.StatusBar;
				var CustomBar= this.CustomBar;
				var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
				return style
			}
		},
		methods: {
			BackPage() {
				uni.navigateBack({
					delta:1
				})
			},
			goToProfile(userId) {
				this.$Router.push({
					name:'profile',
					params: {
						authorId: userId
					}
				})
			},
			goToContentDetail(contentId, columnType) {
				if(columnType == '1') {
					this.$Router.push({
						name:'article',
						params:{
							id: contentId,
						},
					});
				} else if(columnType == '2') {
					this.$Router.push({
						name:'courseDetail',
						params:{
							id: contentId,
						},
					});
				} else if(columnType == '3') {
					this.$Router.push({
						name:'journalDetail',
						params:{
							journalSubjectId: contentId,
						},
					});
				} else if(columnType == '4') {
					this.$Router.push({
						name:'bookDetail',
						params:{
							id: contentId,
						},
					});
				}
			}
		},
		onLoad() {
			this.$http.get(`/edu/like/likedUserList/${this.userId}`)
			.then(res=>{
				console.log(res)
				let data = res.data;
				 if (data.success) {
					this.likedList = data.result;
				}
			}).catch(err => {
				console.log(err);
			});
		}
	}
</script>

<style>
</style>
